

package cn.shengchao.examstar.product.ohs.local.message;

import cn.shengchao.examstar.product.domain.entity.CourseKnowledgeNode;
import cn.shengchao.examstar.product.domain.entity.Teacher;
import lombok.Data;

@Data
public class KnowledgeNodeDto {
    private Long id;
    //课程id
    private Long courseId;
    //课程类型
    private Integer courseType;
    //封面
    private String cover;
    //知识点名称
    private String name;
    //价格
    private Double price;
    //折扣价格
    private Double discountPrice;
    //时长
    private Double duration;
    //播放地址
    private String playUrl;
    //老师
    private Teacher teacher;
    //父节点id
    private Long parentId;
    //排序
    private Integer sort;
    //进度
    private Long progress;
    //是否解锁
    private boolean unlock;
    //是否课时
    private Long isLesson;
    //观看进度(秒)
    private Long watchProgress;

    public static KnowledgeNodeDto of(CourseKnowledgeNode item) {
        KnowledgeNodeDto knowledgeNodeDto = new KnowledgeNodeDto();
        knowledgeNodeDto.setId(item.getId());
        knowledgeNodeDto.setName(item.getName().getValue());
        knowledgeNodeDto.setPrice(item.getPrice().getPrice().doubleValue());
        knowledgeNodeDto.setDiscountPrice(item.getDiscountPrice().getPrice().doubleValue());
        knowledgeNodeDto.setDuration(item.getDuration());
        knowledgeNodeDto.setPlayUrl(item.getPlayUrl());
        knowledgeNodeDto.setTeacher(item.getTeacher());
        knowledgeNodeDto.setParentId(item.getParentId());
        knowledgeNodeDto.setIsLesson(item.getIsLesson());
        knowledgeNodeDto.setSort(item.getSort());
        knowledgeNodeDto.setCourseId(item.getCourseId());
        return knowledgeNodeDto;
    }

}
